package com.pmcc.platform.base.web;

import com.pmcc.platform.base.entity.FileEntity;
import com.pmcc.platform.base.service.FileManageService;
import com.pmcc.utils.AntPage;
import com.pmcc.utils.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created by syk on 17/7/11.
 */
@RestController()
@RequestMapping("api/v1/fileManage")
public class FileManageController {

    @Autowired
    FileManageService fileManageService;


    @GetMapping("queryByPage")
    public ResultBean queryByPage(AntPage antPage, FileEntity model) {
        return fileManageService.queryByPage(antPage, model);
    }

    /**
     * 文件上传
     *
     * @param file
     * @return
     */
    @RequestMapping("uploadFile")
    @ResponseBody
    public ResultBean uploadFile(MultipartFile file) {
        return fileManageService.uploadFile(file);
    }

    @GetMapping("delete")
    public ResultBean delete(String id) {
        return fileManageService.delete(id);
    }
}
